package com.xhwl.data.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xhwl.common.dto.cent.sdata.GroupDTO;
import com.xhwl.common.pojo.ResultJson;
import com.xhwl.common.pojo.cent.sdata.Account;
import com.xhwl.common.pojo.cent.sdata.Group;
import com.xhwl.common.pojo.cent.sdata.Space;
import com.xhwl.common.query.cent.sdata.GroupQuery;
import com.xhwl.common.query.cent.sdata.SpaceQuery;
import com.xhwl.common.vo.cent.sdata.GroupCountVO;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author JCccc
 * @Description
 * @Date 2021/6/15 13:39
 */
@RestController
public interface IGroupService extends IService<Group> {
    /**
     * 新增用户组
     *
     * @param groupDTO
     * @return
     */
    @RequestMapping(value = "/group-service/create", method = RequestMethod.POST)
    ResultJson createGroup(@RequestPart("groupDTO") GroupDTO groupDTO);

    /**
     * 修改用户组
     *
     * @param groupDTO
     * @return
     */
    @RequestMapping(value = "/group-service/update", method = RequestMethod.POST)
    ResultJson updateGroup(@RequestPart("groupDTO") GroupDTO groupDTO);

    /**
     * 删除用户组
     *
     * @param id
     * @return
     */
    @RequestMapping(value = "/group-service/delete", method = RequestMethod.POST)
    ResultJson deleteGroup(@RequestPart("id") Integer id);

    /**
     * 获取用户组 分页
     *
     * @param page
     * @param groupQuery
     * @return
     */
    @RequestMapping(value = "/group-service/page-list", method = RequestMethod.POST)
    Page<GroupDTO> getPageList(@RequestPart("page") Page page, @RequestPart("groupQuery") GroupQuery groupQuery);

    /**
     * 获取用户组 不分页
     *
     * @param groupQuery
     * @return
     */
    @RequestMapping(value = "/group-service/list", method = RequestMethod.POST)
    List<GroupDTO> getList(@RequestPart("groupQuery") GroupQuery groupQuery);

    /**
     * 根据id获取组信息
     *
     * @param id
     * @return
     */
    @RequestMapping(value = "/group-service/get-by-id", method = RequestMethod.POST)
    GroupDTO getById(@RequestPart("id") Integer id);

    /**
     * 根据用户组id统计出关联的账号数
     *
     * @param projectId
     * @param applicationName
     * @return
     */
    @RequestMapping(value = "/group-service/count-list", method = RequestMethod.POST)
    List<GroupCountVO> getCountList(@RequestParam("projectId") Integer projectId, @RequestParam("applicationName") String applicationName);

    /**
     * 分页获取组下账号信息
     */
    @RequestMapping(value = "/group-service/getGroupAccPage", method = RequestMethod.POST)
    Page<Account> getGroupAccPage(@RequestPart("page") Page page, @RequestPart("groupQuery") GroupQuery query);

    @RequestMapping(value = "/group-service/groupPage", method = RequestMethod.POST)
    Page<Group> page(@RequestPart("page") Page page, @RequestPart("groupQuery") GroupQuery groupQuery);

}
